﻿
namespace Leetcode.N0991;
public class Solution
{
    public int BrokenCalc(int startValue, int target)
    {
        if (startValue >= target)
        {
            return startValue - target;
        }

        if (target % 2 == 1)
        {
            return this.BrokenCalc(startValue, target + 1) + 1;
        }
        else
        {
            return this.BrokenCalc(startValue, target / 2) + 1;
        }
    }
}